package bepviet.android.engine;

import bepviet.android.ui.ListMonAn;
import bepviet.android.ui.ListNguyenLieu;
import bepviet.android.ui.ListTheLoai;
import bepviet.android.ui.ListXuatXu;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.TabHost;
import android.widget.Toast;

public class BepvietHome extends TabActivity{
	
	 public void onCreate(Bundle a) {    
			super.onCreate(a);
	        setContentView(R.layout.main);  
	        Resources res = getResources();
	        TabHost tabHost = getTabHost();
	        TabHost.TabSpec spec;
	        Intent intent;
	        
	        intent = new Intent().setClass(this,ListMonAn.class);        
	        spec = tabHost.newTabSpec("MónĂn").setIndicator("",res.getDrawable(R.drawable.food2)).setContent(intent);
	        tabHost.addTab(spec);
	        
	        intent = new Intent().setClass(this,ListTheLoai.class);
	        spec = tabHost.newTabSpec("ThểLoại").setIndicator("",res.getDrawable(R.drawable.food)).setContent(intent);
	        tabHost.addTab(spec);        
	        
	        intent = new Intent().setClass(this,ListXuatXu.class);
	        spec = tabHost.newTabSpec("XuấtXứ").setIndicator("",res.getDrawable(R.drawable.from)).setContent(intent);
	        tabHost.addTab(spec);
	        
	        intent = new Intent().setClass(this,ListNguyenLieu.class);
	        spec = tabHost.newTabSpec("NguyênLiệu").setIndicator("",res.getDrawable(R.drawable.material)).setContent(intent);
	        tabHost.addTab(spec);
	        
	        tabHost.setCurrentTab(2);
	  
	    }
	    
	    
	    @Override
	    public boolean onCreateOptionsMenu(Menu menu) {
	     MenuInflater myMenuInflater = getMenuInflater();
	     myMenuInflater.inflate(R.menu.menu, menu);
	        return true;
	    }
	    
	    public boolean onOptionsItemSelected(MenuItem item) {
	    	  // TODO Auto-generated method stub
	    	  switch(item.getItemId()){
	    	   case(R.id.menu_home):
	    	   	startActivity(new Intent(this,Main.class));
	    	    break;
	    	   case(R.id.menu_bookmark):
	    	    Toast.makeText(this, "Help", Toast.LENGTH_LONG).show();
	    	    break; 
	    	   case(R.id.menu_dataList):
	    	    Toast.makeText(this, "Cancel", Toast.LENGTH_LONG).show();
	    	    break;
	    	  } 
	    	  return true;
	    	 } 
}
